From: Florian Müllner Date: Tue, 31 May 2011 16:49:36 +0000 (+0200) Subject: workspaceThumbnail: Handle minimized windows X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~8164 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=a34071e1c32b04e159fa0b1cb6c1547e9f80d12c;p=gnome-shell.git workspaceThumbnail: Handle minimized windows Workspace thumbnails are supposed to be miniatures of the "real" workspace they represent, but currently they show minimized windows like the window picker. Instead, hide minimized windows and track changes to update the thumbnail accordingly. https://bugzilla.gnome.org/show_bug.cgi?id=651569 --- diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js index 8c12e86c0..97b449fb9 100644 --- a/js/ui/workspaceThumbnail.js +++ b/js/ui/workspaceThumbnail.js @@ -178,6 +178,11 @@ WorkspaceThumbnail.prototype = { // Create clones for windows that should be visible in the Overview this._windows = []; for (let i = 0; i < windows.length; i++) { + windows[i].meta_window._minimizedChangedId = + windows[i].meta_window.connect('notify::minimized', + Lang.bind(this, + this._updateMinimized)); + if (this._isOverviewWindow(windows[i])) { this._addWindowClone(windows[i]); } @@ -257,11 +262,18 @@ WorkspaceThumbnail.prototype = { return; // Check if window still should be here - if (win && this._isMyWindow(win)) + if (win && this._isMyWindow(win) && this._isOverviewWindow(win)) return; let clone = this._windows[index]; this._windows.splice(index, 1); + + if (win && this._isOverviewWindow(win)) { + if (metaWin._minimizedChangedId) { + metaWin.disconnect(metaWin._minimizedChangedId); + delete metaWin._minimizedChangedId; + } + } clone.destroy(); }, @@ -290,6 +302,11 @@ WorkspaceThumbnail.prototype = { if (this._lookupIndex (metaWin) != -1) return; + if (!metaWin._minimizedChangedId) + metaWin._minimizedChangedId = metaWin.connect('notify::minimized', + Lang.bind(this, + this._updateMinimized)); + if (!this._isMyWindow(win) || !this._isOverviewWindow(win)) return; @@ -316,6 +333,13 @@ WorkspaceThumbnail.prototype = { } }, + _updateMinimized: function(metaWin) { + if (metaWin.minimized) + this._doRemoveWindow(metaWin); + else + this._doAddWindow(metaWin); + }, + destroy : function() { this.actor.destroy(); }, @@ -326,6 +350,14 @@ WorkspaceThumbnail.prototype = { global.screen.disconnect(this._windowEnteredMonitorId); global.screen.disconnect(this._windowLeftMonitorId); + for (let i = 0; i < this._windows.length; i++) { + let metaWin = this._windows[i].metaWindow; + if (metaWin._minimizedChangedId) { + metaWin.disconnect(metaWin._minimizedChangedId); + delete metaWin._minimizedChangedId; + } + } + this._windows = []; this.actor = null; }, @@ -339,7 +371,8 @@ WorkspaceThumbnail.prototype = { // Tests if @win should be shown in the Overview _isOverviewWindow : function (win) { let tracker = Shell.WindowTracker.get_default(); - return tracker.is_window_interesting(win.get_meta_window()); + return tracker.is_window_interesting(win.get_meta_window()) && + win.get_meta_window().showing_on_its_workspace(); }, // Create a clone of a (non-desktop) window and add it to the window list